<template>
  <div class="charts" ref="line" />
</template>

<script>
import * as echarts from 'echarts'
import resize from '@/mixin/resize'

export default {
  name: 'UserChart',
  mixins: [resize],
  mounted() {
    const myEcharts = echarts.init(this.$refs.line)
    myEcharts.setOption({
      grid: {
        top: 0,
        bottom: 0,
        right: '-7%',
        left: '-7%'
      },
      xAxis: {
        show: false,
        data: [1, 2, 3, 4, 5, 6, 7, 8, 9]
      },
      yAxis: { show: false },
      series: {
        type: 'line',
        data: [1500, 700, 2000, 800, 1800, 2700, 300, 1300, 2100],
        smooth: true,
        itemStyle: {
          opacity: 0
        },
        lineStyle: {
          color: '#5B8FF9'
        },
        areaStyle: {
          color: {
            type: 'linear',
            x: 0,
            y: 0,
            x2: 0,
            y2: 1,
            colorStops: [
              {
                offset: 0,
                color: '#5B8FF9' // 0% 处的颜色
              },
              {
                offset: 1,
                color: '#fff' // 100% 处的颜色
              }
            ],
            global: false // 缺省为 false
          }
        }
        // symbol: {
        //   // emptyCircle: 'none'
        // }
      }
    })
    this.myEcharts = myEcharts
  }
}
</script>

<style lang="scss" scoped>
.charts {
  width: 100%;
  height: 100%;
}
</style>
